export default {
	methods: {
		uploadFile(filePath, name = 'file', url = 'http://192.168.1.167:8200/lw-partner/file/uploadFile') {
			uni.showLoading({ title: 'uploading' })
			return new Promise((resolve, reject) => {
				try {
					uni.uploadFile({
						url,
						filePath,
						fileType: 'image',
						name, 
						success: res => {
							uni.hideLoading()
							resolve(JSON.parse(res.data))
						}
					})
				} catch (error) {
					uni.hideLoading()
					uni.showToast({ title: 'uploading error!' })
					reject(error)
				}
			})
		}
	}
}
